home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / guidesmodel.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-23  |  2.1 KB  |  70 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. #ifndef GUIDESMODEL_H
  8. #define GUIDESMODEL_H
  9.  
  10. #include <QAbstractTableModel>
  11. #include "scribusstructs.h"
  12.  
  13.  
  14. /*! \brief A model for guides lists.
  15. It holds guides as a double QList (it will be expanded later because of RFEs)
  16. and it handles its values editing too. The editor from GuidesDelegate
  17. is used.
  18. See Qt4 documentation for more info about its methods.
  19. FIXME: unit conversions for dipslay vs. internal
  20. \author Petr Vanek <petr@scribus.info>
  21. */
  22. class GuidesModel : public QAbstractTableModel
  23. {
  24.     Q_OBJECT
  25.  
  26.     public:
  27.         GuidesModel(QObject * parent = 0);
  28.         ~GuidesModel();
  29.  
  30.         int rowCount(const QModelIndex & parent = QModelIndex()) const;
  31.         int columnCount(const QModelIndex & parent = QModelIndex()) const;
  32.  
  33.         QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
  34.         bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
  35.  
  36.         Qt::ItemFlags flags(const QModelIndex & index) const;
  37.  
  38.         QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
  39.  
  40.         void removeValues(const Guides & v);
  41.         // qt4 api is "wrokarounded" with insertRow() and removeValues()
  42.         // these removeRows() and insertRows() does not handle margin items correctly
  43. //         bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
  44. //         bool insertRows( int row, int count, const QModelIndex & parent = QModelIndex());
  45.         void insertRow();
  46.  
  47.         //! \brief Set new values into the model.
  48.         void setValues(Guides values);
  49.         //! \brief Get values back to the app.
  50.         Guides values();
  51.  
  52.         void unitChange(int docUnitIndex, int docUnitDecimals);
  53. #if 0
  54.         //! debug only
  55.         void printValues();
  56. #endif
  57.  
  58.     signals:
  59.         /*! \brief Signal emmitted when the user finish the editation of one value.
  60.         */
  61.         void valueChanged();
  62.  
  63.     private:
  64.         Guides m_values;
  65.         int m_docUnitIndex;
  66.         int m_docUnitDecimals;
  67. };
  68.  
  69. #endif
  70.